#include "v3d_interface.h"
#include <v3d_defs.h>

#include "glut_interface.h"

v3d_window_type v3d_interface::window_type = WINDOW_TYPE_GLUT;
v3d_interface *v3d_interface::I = NULL;

v3d_interface::v3d_interface(void)
{
	LOG("hello v3d_interface ......\n");

	v3d_interface::window_type = WINDOW_TYPE_GLUT;
}

v3d_interface::~v3d_interface(void)
{

}

void v3d_interface::MessageImmediate(int message_id, void *param)
{
	LOG("msgID %d\n", message_id);

	switch(message_id)
	{
	case MSG_V3D_OBJECT:
		v3d = (v3d_object *)param;
		break;
	case MSG_V3D_RENDERER_OBJECT:
		v3dRenderer = (v3d_object *)param;
		break;
	case MSG_I_RENDER_START:
		Start();
		break;
	}
}
void v3d_interface::Update(int message_id, void *param)
{

}

void v3d_interface::Init()
{
	LOG("v3d_interface init called ... \n");
	if(window_type == WINDOW_TYPE_GLUT)
	{
		I = new glut_interface();
		I->InitWindow();
	}

}

void v3d_interface::DeInit()
{
	if(I != NULL)
	{
		LOG("Destroying v3d_interface...\n");
		delete I;
		v3d_interface::I = NULL;

	}
}
